package com.tangding.log.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.tangding.common.utils.JacksonUtil;
import com.tangding.log.LogMatcher;
import com.tangding.service.dao.user.UserRepository;
import com.tangding.service.entity.user.User;

/**
 * @description 发送给管理员监控用户日志
 *
 * @author Ranger
 * @version 2017年12月20日_上午10:32:04
 *
 */
@Component
public class WatchingUsersLog extends LogMatcher {
	
	@Autowired
	UserRepository userRepository;

	@Override
	public String cmdDisplay(String cmd, Object... args) {
		Object[] as = (Object[])(args[0]);
		String admin = JacksonUtil.get(as[0], "admin", true);
		User user = userRepository.getUserByUid(admin);
		String userName = "";
		if (user != null) {
			userName = user.getName();
		}
		return "发送用户让（" + userName + "）监控";
	}

}
